package com.study.sfd.medicine.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.study.sfd.medicine.entity.MedicineImgsEntity;
import com.study.sfd.medicine.service.MedicineImgsService;
import com.study.common.utils.PageUtils;
import com.study.common.utils.R;



/**
 * medicine_imgs(药品外包装图片)
 *
 * @author 王个球
 * @email wangdajunzy@163.com
 * @date 2021-11-12 13:37:43
 */
@RestController
@RequestMapping("medicine/medicineimgs")
public class MedicineImgsController {
    @Autowired
    private MedicineImgsService medicineImgsService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    // @RequiresPermissions("medicine:medicineimgs:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = medicineImgsService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    // @RequiresPermissions("medicine:medicineimgs:info")
    public R info(@PathVariable("id") Integer id){
		MedicineImgsEntity medicineImgs = medicineImgsService.getById(id);

        return R.ok().put("medicineImgs", medicineImgs);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    // @RequiresPermissions("medicine:medicineimgs:save")
    public R save(@RequestBody MedicineImgsEntity medicineImgs){
		medicineImgsService.save(medicineImgs);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    // @RequiresPermissions("medicine:medicineimgs:update")
    public R update(@RequestBody MedicineImgsEntity medicineImgs){
		medicineImgsService.updateById(medicineImgs);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    // @RequiresPermissions("medicine:medicineimgs:delete")
    public R delete(@RequestBody Integer[] ids){
		medicineImgsService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
